package cn.edu.hit.education.model;

import java.util.ArrayList;
import java.util.List;

public class Node {
	private int id;
	private String name;
	private Node parent;
	private List<Node> children = new ArrayList<Node>(10);

	Node() {
	}

	Node(Node parent) {
		this.setParent(parent);
	}
	
	public Node(int id, String name) {
		super();
		this.id = id;
		this.name = name;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Node getParent() {
		return parent;
	}

	public void setParent(Node parent) {
		this.parent = parent;
	}

	public void addChild(Node child) {
		child.setParent(this);
		children.add(child);
	}

	public void removeChild(Node child) {
		children.remove(child);
	}

	public List<Node> getChildren() {
		return children;
	}

}